package 尊享面试.哈希;

import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedHashMap;

public class a760找出变位映射 {
    static class Solution {
        public int[] anagramMappings(int[] nums1, int[] nums2) {
            HashMap<Integer, Integer> map = new LinkedHashMap<>();
            int len = nums2.length;
            int[] res = new int[len];
            for (int i = 0; i < len; i++) {
                map.put(nums2[i], i);
            }
            System.out.println(map);
            for (int i = 0; i < len; i++) {
                res[i] = map.get(nums1[i]);
            }
            return res;
        }
    }

    public static void main(String[] args) {
        Solution solution = new Solution();
        int[] nums1 = {12, 28, 46, 32, 50};
        int[] nums2 = {50, 12, 32, 46, 28};
        System.out.println(Arrays.toString(solution.anagramMappings(nums1, nums2)));
    }
}
